/**
 * @description sequelize实例
 * **/


const Sequelize = require('sequelize/index')

const { MYSQL_CONFIG } = require('../conf/db')
const { isProd, isTest } = require('../utils/env')

const { username, password, dataBase, host } = MYSQL_CONFIG

const config = {
  host: host,
  dialect: 'mysql',
}
if (isTest) {
  config.loggin = () => { }
}
if (isProd) {
  config.pool = MYSQL_CONFIG.pool
}

const seq = new Sequelize(dataBase, username, password, config)

module.exports = seq